/*
 * @Descripttion: 
 * @version: 
 * @Author: Lome
 * @Date: 2019-12-29 01:56:45
 * @LastEditors: Lome
 * @LastEditTime: 2020-05-13 19:17:57
 */
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui'
import './styles.scss'
import 'element-ui/lib/theme-chalk/index.css'
import uploader from 'vue-simple-uploader'

import ViewUI from 'view-design'
import 'view-design/dist/styles/iview.css'

import BaiduMap from 'vue-baidu-map'

Vue.use(BaiduMap, {
	ak: 'rF9GWU0A8pW3awgAM5CyedhyPo7XSuKR'
})
Vue.use(ViewUI)
Vue.use(uploader)
Vue.use(ElementUI)

import plTable from 'pl-table'
import 'pl-table/themes/index.css' // 引入样式（必须引入)，请查看webpack是否配置了url-loader对woff，ttf文件的引用,不配置会报错哦
import 'pl-table/themes/plTableStyle.css' // 默认表格样式很丑 引入这个样式就可以好看啦（如果你不喜欢这个样式，就不要引入，不引入就跟ele表格样式一样）
Vue.use(plTable)

Vue.config.productionTip = false
import axios from 'axios'
import qs from 'qs'

Vue.prototype.axios = axios
Vue.prototype.qs = qs
//默认后台接口前缀
// axios.defaults.baseURL = 'http://49.4.124.162:9288/'
axios.defaults.baseURL = 'http://47.94.11.219:9988/'
// axios.defaults.baseURL = 'http://192.168.0.211:9988/'
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'

Vue.directive('verify', {
	// 当被绑定的元素插入到 DOM 中时……
	bind: function(el, binding, vnode) {
		// console.log('66666666666666', el, binding, vnode)
		// console.log('66666666666666', binding)
		// var isTrue = binding.value.value
		// if (isTrue == 1) {
		//   var div = document.createElement('hr')
		//   div.classList.add('isRepalceLine')
		//   el.append(div.cloneNode())
		// }
		// if (isTrue == 2) {
		//   el.style.color = 'red'
		// }
	},
	update: function(el) {},
	unbind: function(el) {},

	inserted: function(el, binding, vnode) {
		console.log('555', el, binding, vnode)
		var value = vnode.data.model.value
		// console.log('777', value)
		if (value == '') {
			if (el.getElementsByTagName('textarea').length > 0) {
				el.getElementsByClassName('el-textarea__inner')[0].style.border = '1px solid #E35042'
			}
			if (el.getElementsByTagName('input').length > 0) {
				el.getElementsByClassName('el-input__inner')[0].style.border = '1px solid #E35042'
			}
			var div = document.createElement('p')
			div.classList.add('errorText')
			div.style.color = '#E35042'
			div.style.textAlign = 'left'
			div.innerText = '不能为空'
			el.append(div)
		}
	}
})

new Vue({
	router,
	store,
	render: function(h) {
		return h(App)
	}
}).$mount('#app')
